/*
 *  $Id: RitualFlame.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

using System.Collections.Generic;

namespace Ragima.Cards001.Fire.Spells {
    public class RitualFlame: SpellCard {
        public RitualFlame(): base("001_f_s_ritual_flame") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Fire;
            Value = 100;
            AddManaCost(ElementType.Fire, 2);
            AddCondition(new DelegateCondition(GetConditionPhrase(), TestRitualFlame));
        }

        private static bool TestRitualFlame(AbstractObject caster, Card card) {
            return caster.Owner.GetCreatureCount() > 0 && caster.Owner.Graveyard.Count > 0;
        }

        private static readonly Languages.CardPhrase<RitualFlame> Action = new Languages.CardPhrase<RitualFlame>("action");

        public override void DoAction(TargetArgs args) {
            List<GraveyardItem> items = args.Player.Graveyard.GetItemsWithoutAntimagic(args.Player.GetCreatureCount());
            args.Player.Graveyard.MoveTo(items, args.Player.SecondDeck);
            args.Player.Game.Log.Add(Action.Phrase, items.Count);
        }
    }
}
